<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    // const arr = [1,2,3,4,5,6,7,8,9]
    // const arr1 = arr.find(function(item,index,array){
    //     // console.log(item,index,array);
    //     return item > 3
    // })
    // // console.log(arr1);
    // const arr2 = [1, 2, 3, [3, 3, 1, [2, 2,3 , [4, 4,4, [5,5,5, [6, 6, 7, [88]]] ]]]];
    // const arr3 = arr2.flat(Infinity);
    // // console.log(arr3)
    // const s = new Set([1,2, 3, 1, 2, 3, 'a', 'b', 'a', true, true, false]);
    // // console.log(s);  // 去重
    // // const s1 = new Set()
    // // s1.add(arr)
    // // console.log(s1);
    // // console.log(s.has(3));
    
    {//数组去重
        {
            let arr = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6]
            let arr1 = arr.filter((item,index) => {
                return arr.indexOf(item) == index
            })
            console.log(arr1);
        }
        {
            let arr = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6]
            let s = new Set(arr)
            console.log(s);
        }
        {
            function ars(array) {
                for (let index = 0; index < array.length - 1; index++) {
                    for (let j = index + 1; j < array.length; j++) {
                        if(array[index] == array[j]){
                            array.splice(j,1)
                            j--
                        }
                    }
                }
                return array
            }
            let arr = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6]
            console.log(ars(arr));
        }
    }
    
    {//对象深拷贝

        const obj = {
                name: 'ming',
                age: 43,
                child: {
                    name: 'hong',
                    age: 19,
                    say() {
                    console.log('hong', this);
                    }
                },
                say() {
                    console.log('ming', this);
                } 
            }
        
        const obj1 = JSON.stringify(obj.child)
        console.log(obj1,typeof(obj));
    }
</script>